package cn.fl.audit.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.audit.dto.AudVisitCarDTO;
import cn.fl.audit.vo.AudVisitCarVO;

 /**
 * @Description: 乘用车回访扩展表 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class AudVisitCarVOTransform {


	/**
	 * DTO 转  VO
	 * @param po AudVisitCarDTO
	 * @return AudVisitCarVO
	 */
	public static AudVisitCarVO toVO(AudVisitCarDTO dto) {
		AudVisitCarVO  vo = null;
		if (dto != null) { 
			vo = new AudVisitCarVO();
			vo.setId(dto.getId());
			vo.setVisitId(dto.getVisitId());//回访外键ID
			vo.setWorkTypeCd(dto.getWorkTypeCd());//工作方式-AUD0030
			vo.setCompanyName(dto.getCompanyName());//单位名称
			vo.setCompanyAddressCd(dto.getCompanyAddressCd());//单位地址-AUD0008
			vo.setWorkYeays(dto.getWorkYeays());//工作年限
			vo.setPostCd(dto.getPostCd());//职务-CST0025
			vo.setWork(dto.getWork());//工作内容
			vo.setMonthIncome(dto.getMonthIncome());//月收入
			vo.setSalaryWayCd(dto.getSalaryWayCd());//工资发放方式-AUD0031
			vo.setIsSocialSecurity(dto.getIsSocialSecurity());//是否缴纳有社保 SYS0021
			vo.setCarUse(dto.getCarUse());//车辆用途
			vo.setDownPaymentCd(dto.getDownPaymentCd());//首付款来源 AUD0032
			vo.setSecondRepayment(dto.getSecondRepayment());//第二还款来源
			vo.setOtherDebt(dto.getOtherDebt());//其他负债
			vo.setSpouseInfo(dto.getSpouseInfo());//配偶情况
			vo.setOtherInfo(dto.getOtherInfo());//其它信息
			vo.setCompanyDesc(dto.getCompanyDesc());//主营公司介绍
			vo.setBusiness(dto.getBusiness());//经营项目
			vo.setOperatingPeriod(dto.getOperatingPeriod());//经营期限
			vo.setCompanyIncome(dto.getCompanyIncome());//公司收入情况
			vo.setSourceIncome(dto.getSourceIncome());//收入来源

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto AudVisitCarVO
	 * @return AudVisitCarDTO
	 */
	public static AudVisitCarDTO toDTO(AudVisitCarVO vo) {
		AudVisitCarDTO dto = null;
		if (vo != null) {
			dto = new AudVisitCarDTO();
			dto.setId(vo.getId());
			dto.setVisitId(vo.getVisitId());//回访外键ID
			dto.setWorkTypeCd(vo.getWorkTypeCd());//工作方式-AUD0030
			dto.setCompanyName(vo.getCompanyName());//单位名称
			dto.setCompanyAddressCd(vo.getCompanyAddressCd());//单位地址-AUD0008
			dto.setWorkYeays(vo.getWorkYeays());//工作年限
			dto.setPostCd(vo.getPostCd());//职务-CST0025
			dto.setWork(vo.getWork());//工作内容
			dto.setMonthIncome(vo.getMonthIncome());//月收入
			dto.setSalaryWayCd(vo.getSalaryWayCd());//工资发放方式-AUD0031
			dto.setIsSocialSecurity(vo.getIsSocialSecurity());//是否缴纳有社保 SYS0021
			dto.setCarUse(vo.getCarUse());//车辆用途
			dto.setDownPaymentCd(vo.getDownPaymentCd());//首付款来源 AUD0032
			dto.setSecondRepayment(vo.getSecondRepayment());//第二还款来源
			dto.setOtherDebt(vo.getOtherDebt());//其他负债
			dto.setSpouseInfo(vo.getSpouseInfo());//配偶情况
			dto.setOtherInfo(vo.getOtherInfo());//其它信息
			dto.setCompanyDesc(vo.getCompanyDesc());//主营公司介绍
			dto.setBusiness(vo.getBusiness());//经营项目
			dto.setOperatingPeriod(vo.getOperatingPeriod());//经营期限
			dto.setCompanyIncome(vo.getCompanyIncome());//公司收入情况
			dto.setSourceIncome(vo.getSourceIncome());//收入来源

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<AudVisitCarDTO>
	 * @return List<AudVisitCarVO>
	 */
	public static List<AudVisitCarVO> toVOList(List<AudVisitCarDTO> list) {
		List<AudVisitCarVO>  voList = new ArrayList<AudVisitCarVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AudVisitCarDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<AudVisitCarVO>
	 * @return List<AudVisitCarDTO>
	 */
	public static List<AudVisitCarDTO> toDTOList(List<AudVisitCarVO> list) {
		List<AudVisitCarDTO>  dtoList = new ArrayList<AudVisitCarDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AudVisitCarVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
